#! /usr/bin/env node

import { program } from 'commander'
import inquirer from 'inquirer'
import fs from 'node:fs'
import ora from 'ora'
import { dirname } from "node:path"
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);

const __dirname = dirname(__filename);

// import { checkPath, downloadTemp } from './utils.js'
// let json = fs.readFileSync('./package.json', 'utf-8')
// json = JSON.parse(json)


program.command('col <apiName>').description(`创建table的columns`).action((apiName) => {
    console.log('apiName: ', apiName);
    console.log('__dirname: ', __dirname);
    console.log('__filename: ', __filename);
    const spinner = ora('创建中...')
    spinner.start();
    setTimeout(() => {
        spinner.stop()
        // spinner.succeed('下载完成')
    }, 1000)

})

program.command('mock <apiName>').description(`创建mock数据`).action((apiName) => {
    console.log('apiName: ', apiName);
    console.log('__dirname1: ', __dirname);
    console.log('__filename1: ', __filename);
})

program.parse(process.argv)
